package com.gong.application;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.List;

// 1. 指定配置前缀（YAML中该前缀下的配置会被绑定）
@ConfigurationProperties("user")
// 2. 注册为Spring组件（或通过@EnableConfigurationProperties启用）
@Component
public class UserConfig {
    // 属性名需与YAML中配置项匹配（支持宽松绑定）
    private String username;
    private Integer age;
    private Boolean enabled;
    private LocalDate birthday; // 日期类型（自动转换）
    private List<String> hobbies; // 集合

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }



    public List<String> getHobbies() {
        return hobbies;
    }

    public void setHobbies(List<String> hobbies) {
        this.hobbies = hobbies;
    }
}


